Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@babel/plugin-proposal-class-static-block
Advanced tools
The @babel/plugin-proposal-class-static-block npm package allows developers to use the static block feature in class definitions within JavaScript code. This feature is a proposal for ECMAScript and is not yet part of the official language specification. The plugin enables Babel to compile code containing static blocks so that it can run in current JavaScript environments.
Static Initialization Blocks
Static initialization blocks allow developers to write a block of code within a class definition that is executed once when the class is created. This is useful for setting up static properties or performing one-time setup for the class.
class MyClass {
static {
// Initialization code
this.myStaticProperty = 'value';
}
}
This package allows the use of private instance methods and accessors in classes. It is similar to @babel/plugin-proposal-class-static-block in that it deals with class features that are not yet part of the ECMAScript standard.
This package provides support for decorators, which are a stage 2 proposal for JavaScript. Decorators are a way to add annotations and a meta-programming syntax for class declarations and members. While decorators are not the same as static blocks, they are another example of a proposed class feature that can be used with Babel.
This package allows developers to use class properties, which are a part of the ECMAScript proposal. It enables both static and instance properties to be defined in a more concise way, similar to how @babel/plugin-proposal-class-static-block allows for static blocks.
Allow parsing of class static blocks
See our website @babel/plugin-proposal-class-static-block for more information.
Using npm:
npm install --save-dev @babel/plugin-proposal-class-static-block
or using yarn:
yarn add @babel/plugin-proposal-class-static-block --dev
FAQs
Transform class static blocks
We found that @babel/plugin-proposal-class-static-block demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.